package com.lam.monitor.domain;

import com.lam.common.utils.NumberUtil;

/**
 * 內存相关信息
 * 
 * @author lam
 */
public class Mem {
	/**
	 * 内存总量
	 */
	private double total;

	/**
	 * 已用内存
	 */
	private double used;

	/**
	 * 剩余内存
	 */
	private double free;

	private String convertM(double n) {
		return NumberUtil.DF_2.format(n/1024/1024/1024);
	}
	
	public String getTotal() {
		return convertM(total);
	}

	public void setTotal(long total) {
		this.total = total;
	}

	public String getUsed() {
		return convertM(used);
	}

	public void setUsed(long used) {
		this.used = used;
	}

	public String getFree() {
		return convertM(free);
	}

	public void setFree(long free) {
		this.free = free;
	}

	public String getUsage() {
		return NumberUtil.DF_2.format(used/total * 100);
	}
}
